<template lang="pug">
  .tab-1
    Table.hasTitle-table.beautiful-table(:columns="thead" :data="deliveryList")
      //- .pr-24.pl-24(slot="header")
      //-   .pull-right
      //-     Button.mr-15(type="info" size="small" @click="addContact") 添加联系人
      template(slot-scope="{ row, index }" slot="jxbg_fujian")
        Poptip(trigger="hover" title="结项报告")
          div(slot="content")
            .u-d-info(v-for="(item, index) in row.reportAttachments" :key="index" @click="downLoadAttachment(item.id, item.name)") {{item.name}}
          Button 查看
      template(slot-scope="{ row, index }" slot="fy_fujian")
        Poptip(trigger="hover" title="费用明细附件")
          div(slot="content")
            .u-d-info(v-for="(item, index) in row.amountAttachments" :key="index" @click="downLoadAttachment(item.id, item.name)") {{item.name}}
          Button 查看
      template(slot-scope="{ row, index }" slot="ht_fujian")
        Poptip(trigger="hover" title="合同附件")
          div(slot="content")
            .u-d-info(v-for="(item, index) in row.attachments" :key="index" @click="downLoadAttachment(item.id, item.name)") {{item.name}}
          Button 查看
      //- template(slot-scope="{ row, index }" slot="action")
        Button.mr-10(type="info" size="small" @click="reviseBtn") 修改
        Button(type="warning" size="small") 删除
    Modal(v-model="reviseModal" title="签约")
      Form(ref="formValidate" :model="formValidate" :rules="ruleValidate" :label-width="130")
        FormItem.mb-5(label="所属需求：" prop="name")
          Input(placeholder="请输入")
        FormItem.mb-5(label="合作名称：" prop="date")
          Input(placeholder="请输入")
        FormItem.mb-5(label="合作价格：" prop="date")
          Input(placeholder="请输入")
        FormItem.mb-5(label="合作内容：" prop="aadd")
          Input(placeholder="请输入")
        FormItem.mb-5(label="谈判挑战：" prop="aadd")
          Input(placeholder="请输入")
        FormItem.mb-5(label="谈判策略：" prop="aadd")
          Input(placeholder="请输入")
        FormItem.mb-5(label="备注信息：")
          Input(type="textarea" placeholder="请输入")
      template(slot="footer")
        Button(type="info" @click="handleSubmit('formValidate')") 提交
        Button(@click="reviseModal = false") 取消
</template>

<script>
import detailMixin from '../detailMixin.js'
export default {
  props: {
    deliveryList: Array
  },
  mixins: [detailMixin],
  data () {
    return {
      isCheck: true,
      name: '总经理',
      reviseModal: false,
      thead: [
        {
          title: '所属合同',
          minWidth: 100,
          key: 'contractNo'
        },
        {
          title: '课程/项目名称',
          minWidth: 130,
          key: 'projectName'
        },
        {
          title: '课程/项目开始日期',
          minWidth: 160,
          render: (h, params) => {
            let row = params.row
            let times = ''
            if (row.startTime) {
              times = row.startTime.slice(0, 10)
            }
            return h('span', times)
          }
        },
        {
          title: '课程/项目结束日期',
          minWidth: 160,
          render: (h, params) => {
            let row = params.row
            let times = ''
            if (row.endTime) {
              times = row.endTime.slice(0, 10)
            }
            return h('span', times)
          }
        },
        {
          title: '讲师/顾问',
          minWidth: 110,
          key: 'teacher'
        },
        {
          title: '合同金额',
          minWidth: 100,
          key: 'contractPayment'
        },
        {
          title: '项目经理/助理',
          minWidth: 130,
          key: 'serverName'
        },
        {
          title: '课酬金额',
          minWidth: 100,
          key: 'payment'
        },
        {
          title: '综合费用',
          minWidth: 100,
          key: 'amount'
        },
        {
          title: '结项报告附件',
          minWidth: 150,
          slot: 'jxbg_fujian'
        },
        {
          title: '综合费用明细附件',
          minWidth: 150,
          slot: 'fy_fujian'
        },
        {
          title: '合同附件',
          minWidth: 100,
          slot: 'ht_fujian'
        }
        // {
        //   title: '操作',
        //   minWidth: 140,
        //   slot: 'action'
        // }
      ],
      formValidate: {
        name: '',
        phone: ''
      },
      ruleValidate: {
        name: [
          { required: true, trigger: 'blur' }
        ],
        date: [
          { type: 'date', required: true, trigger: 'change' }
        ],
        aadd: [
          { required: true, trigger: 'blur' }
        ]
      }
    }
  },
  methods: {
    reviseBtn () {
      this.reviseModal = true
    },
    handleSubmit (name) {
      this.$refs[name].validate((valid) => {
        if (valid) {
          this.$Message.success('Success!')
        } else {
          this.$Message.warning('有必填项未填写！')
        }
      })
    }
  }
}
</script>

<style>

</style>
